/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package session06;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 *
 * @author macbookpro
 */
public class ValidData {

    public static boolean isName(String name) {
        Pattern p = Pattern.compile("^[a-zA-Z]+[a-zA-Z\\s]*$");
        Matcher matcher = p.matcher(name);
        return matcher.find();
    }
    
    public static boolean isPhoneNumber(String phone){
        Pattern p = Pattern.compile("^\\d{10,12}$");
        Matcher matcher = p.matcher(phone);
        return matcher.find();
    }
}
